import {Injectable} from '@angular/core';
import {Talent} from '../entity/talent';
import {Company} from '../entity/company';

@Injectable()
export class AuthService {
  isCompany;
  company: any;
  isTalent;
  talent: any;
  isLoggedIn;

  constructor() {
    this.loadData();
  }

  loadData() {
    this.isCompany = sessionStorage.getItem('isCompany') == 'true';
    this.company = this.isCompany ? JSON.parse(sessionStorage.getItem('account')) : new Company();
    this.isTalent = sessionStorage.getItem('isTalent') == 'true';
    this.talent = this.isTalent ? JSON.parse(sessionStorage.getItem('account')) : new Talent();
    this.isLoggedIn = sessionStorage.getItem('isLoggedIn') == 'true';
  }
}
